from typing import Union

from script.server.ftp.FtpServer import FtpServer
from script.server.ftp.T2mNbServer import T2mNbServer
from script.server.teleweb.T2mShServer import T2mShServer
from script.server.teleweb.TclNbServer import TclNbServer
from script.server.teleweb.TelewebServer import TelewebServer


class Servers(object):
    SERVER_TCLNB = TclNbServer.NAME
    SERVER_T2MNB = T2mNbServer.NAME
    SERVER_T2MSH = T2mShServer.NAME

    SERVERS = {
        SERVER_TCLNB: TclNbServer,
        SERVER_T2MNB: T2mNbServer,
        SERVER_T2MSH: T2mShServer
    }

    @staticmethod
    def create_server(name: str) -> Union[None, FtpServer, TelewebServer]:
        if name in Servers.SERVERS:
            return Servers.SERVERS[name]()
        else:
            return None
